Skip to content

Conversation

@siemen11
Copy link
Contributor

Since the hardened memory operations just return OTCRYPTO_OK the compiler optimizes the status output which circumvents the control flow integrity. An example is

20011276: | | 9e2080e7 jalr
-1566(ra) # 2002bc54 <hardened_memcpy>

2001127a: | | 73900513 li
a0,1849

Launder the status output to circumvent this. Once there is another call in place which makes the possibility to return a different status, this launder is no longer needed.

The assembly files were checked for similar patterns, only a single call in RSA had a similar result.

Since the hardened memory operations just return OTCRYPTO_OK the
compiler optimizes the status output which circumvents the control flow
integrity. An example is

20011276:             |     |         9e2080e7                  jalr
		      -1566(ra) # 2002bc54 <hardened_memcpy>

2001127a:             |     |         73900513                  li
a0,1849

Launder the status output to circumvent this. Once there is another call
in place which makes the possibility to return a different status, this
launder is no longer needed.

The assembly files were checked for similar patterns, only a single call
in RSA had a similar result.

Signed-off-by: Siemen Dhooghe <[email protected]>
@siemen11 siemen11 requested a review from a team as a code owner November 23, 2025 21:05
@siemen11 siemen11 requested review from alees24, johannheyszl and nasahlpa and removed request for a team and alees24 November 23, 2025 21:05
@siemen11 siemen11 added the CherryPick:earlgrey_1.0.0 This PR should be cherry-picked to earlgrey_1.0.0 label Nov 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CherryPick:earlgrey_1.0.0 This PR should be cherry-picked to earlgrey_1.0.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant